package swa2012.telco.broker.beans;

import java.net.URI;

public class Provider {
	private String id;
	private URI endpoint;

	public Provider() {		
	}
	
	public Provider(String id, URI endpoint) {
		this.id = id;
		this.endpoint = endpoint;
	}
	
	public String getID() {
		return id;
	}
	public void setID(String id) {
		this.id = id;
	}
	public URI getBrokerCallbackEndpoint() {
		return endpoint;
	}
	public void setBrokerCallbackEndpoint(URI endpoint) {
		this.endpoint = endpoint;
	}
	
	@Override
	public String toString() {
		return this.getClass().getSimpleName() + "["+ this.id +"@"+ endpoint +"]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((endpoint == null) ? 0 : endpoint.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Provider other = (Provider) obj;
		if (endpoint == null) {
			if (other.endpoint != null)
				return false;
		} else if (!endpoint.equals(other.endpoint))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
}
